<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="com.jframe.sys.utils.StringUtil" %>
<%
int id = StringUtil.parseInt(request.getParameter("id"));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="/inc/editInc.jsp" />
<script type="text/javascript">
var action = 'linkTypeAction';
$(function(){
	$.ajax({
		url: action+'.do?method=getObjById',
		type: 'post',
		data:{id:$('#id').val()},
		dataType:'json',
	    success: function(data){
	    	$('#data').form('load',data);
	    }
	});
	
	var saveForm = function(){
		var validate = $('#data').form('validate');
		if(validate){
		$.ajax({
			url:action+".do?method=save",
			data:{obj:$("#data").form2json()},
			dataType:'json',
			type:'post',
			success:function(data){
				if(data.result==true){
					$('#data').form('load',data.obj);
					alertInfo('保存成功！');
					parent.$('#grid').datagrid('reload');
				}
				else{
					alertError('保存失败！');
				}
			}
		});
		}else{
			return validate;
		}
	};
	$('#saveBtn').click(saveForm);
});
</script>
</head>
<body>
    <form id="data" method="post">
    	<input type="hidden" id="id" name="id" value="<%=id%>"/>
	    <table width="100%" class="tableForm">
	   		 <tr align="center">
		    	<th colspan="4">		    
		    		<span>链接类别管理</span>
			    </th>
		    </tr>
		    <tr>
		    	<td width="20%" align="right">
		    		权限代码：
		    	</td>
			    <td width="30%" align="left">
			    	<input type="text" id="code" name="code" required="true" style="width:120px;" class="easyui-validatebox"/>
			    </td>		   
				<td align="right" width="20%">
		    		类型名称：
		    	</td>
				<td width="30%">
					<input type="text" id="name" name="name" required="true" style="width:120px;" class="easyui-validatebox"/>
				</td>
			</tr>
			 <tr>
		    	<td width="20%" align="right">
		    		图片宽度：
		    	</td>
			    <td width="30%" align="left">
			    	<input type="text" id="imgwidth" name="imgwidth"  style="width:120px;" class="easyui-validatebox"/>
			    </td>		   
				<td align="right" width="20%">
		    		图片高度：
		    	</td>
				<td width="30%">
					<input type="text" id="imgheight" name="imgheight"  style="width:120px;" class="easyui-validatebox"/>
				</td>
			</tr>
			<tr>
				<td align="right" width="20%">
		    		父类别：
		    	</td>
				<td width="30%">
					<select id="upId" name="upId"  class="easyui-combotree" style="width:125px;" url="<%=request.getContextPath()%>/linkTypeAction.do?method=getCombotree&key=sm_cms_linkType"></select>
				</td>		    	
				<td align="right" width="20%">
		    		顺序：
		    	</td>
				<td width="30%">
					<input type="text" id="seq" name="seq" required="true" style="width:120px;" class="easyui-validatebox"/>
				</td>
			</tr>
			<tr>
				<td align="right" width="20%">
		    		有效否：
		    	</td>
				<td width="30%">
					<select id="active" name="active"  required="true" class="easyui-combobox" style="width:125px;">
						<option value="1">有效</option>
						<option value="0">无效</option>
					</select>
				</td>
			</tr>
			<tr align="center">
				<td colspan="4">
					<a id='saveBtn' class="easyui-linkbutton" plain="true" iconCls="icon-save">保存</a>
				</td>
			</tr>
		</table>
    </form>
</body>
</html>